<?php
if (isset($_POST['name'])) {
	
	$name=$_POST['name'];
	$description=$_POST['description'];

	
// 	12
// 1\2\
$link=mysqli_connect("127.0.0.1",'root','123456','company');
// 3
$query="insert into department(name,description)values('$name','$description')";
$result=mysqli_query($link, $query);
// 4
$number=mysqli_affected_rows($link);
if ($number>0) {
// 	echo "插入成功";
	echo "<script>";
	echo "location.href='select.php';";
	echo "</script>";
}else{
	echo "<script>";
	echo "alert('插入失败！');";
	echo "location.href='select.php';";
	echo "</script>";
	
}

// 5
mysqli_close($link);
	
	
	
	
	
	
	
	
	
}


?>